<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="./dist/css/layui.css">
    <script src="../jquery.min.js"></script>
    <script src="./dist/layui.js"></script>
    <style>
        .red {
            background-color: red;
        }
    </style>
</head>


<body>
    <ul class="feedback_box">
        <li class="experience_float">
            <a href="./experience_card_apply.html"></a>
        </li>
        <li class="feedback_box_text float_android">APP下载<i><img src="./img/float_android.png"></i></li>
        <li class="feedback_box_text float_qq">QQ群<i><img src="./img/float_qq.png"></i></li>
        <li class="feedback_box_text float_weixin">官方微信<i><img src="./img/float_weixin.jpg"></i></li>
        <li class="home_msg feedback_box_text">意见反馈</li>
    </ul>
    <script>
        var Common = {
            parame: {
                IP: "0",
                productId: "",
                emailFilter: /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
                COOKIETIME: 21600,
                phoneFilter: /^1(3|4|5|6|7|8|9)\d{9}$/, //手机验证
                usernameFilter: /^(?![0-9]+$)(?![a-zA-Z]+$)[A-Za-z0-9][0-9A-Za-z]{2,19}$/, //用户名验证
                passwordFilter: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,14}$/, //密码
                nameFilter: /^([\u4E00-\u9FA5]|[\uFE30-\uFFA0])*$/ //姓名
            },
            init: function() {

            },
            checkLoginAuthority: function(address) {
                var _this = this;
                var content = '<div class="l_wrap">' +
                    '<p class="l_title">登录</p>' +
                    '<input type="text" placeholder="请输入手机号" id="loginName" class="box_logname">' +
                    '<div class="l_warn"><p class="l_name_warn hidden">您输入的手机号无效，请重新输入</p></div>' +
                    '<input type="password" placeholder="请输入用密码" id="password" class="box_password">' +
                    '<div class="l_warn"><p class="l_pwd_warn hidden">密码输入错误，请重新输入</p></div>' +
                    '<div class="l_tool"><input type="checkbox" id="l_auto"><label for="l_auto"></label><span>下次自动登录</span><a href="./login_repwd_phone.html" class="l_forget">忘记密码</a></div>' +
                    '<div class="l_login">登录</div>' +
                    '<div class="l_tip"><span>还没有一个账号？现在加入</span><div class="l_go_register"><a href="./register.html">注册</a></div></div></div>';
                debugger;
                layui.use('layer', function() {
                    debugger;
                    layer.open({
                        type: 1,
                        title: "&nbsp;",
                        content: content,
                        skin: "check-layer-style",
                        closeBtn: 1,
                        area: "408px",
                        shade: 0.5
                    })
                });
                var _login = function() {
                    var loginName = $(".box_logname").val().trim();
                    var password = $(".box_password").val().trim();
                    var param = {
                        loginName: loginName,
                        password: password
                    };
                    if (loginName == "") {
                        $(".l_name_warn").html("请输入您的手机号").show();
                    } else if (password == "") {
                        $(".l_pwd_warn").html("请输入密码").show();
                    } else {
                        if ($("#l_auto").is(":checked")) {
                            _this.addCookie("loginName", loginName, _this.parame.COOKIETIME);
                            _this.addCookie("password", password, _this.parame.COOKIETIME);
                        }
                        GlobalCommon.GlobalAjax.Login(param, function(result) {
                            if (result.code == 200) {
                                _this.addSessionStorage("token", result.data.token);
                                if (address) {
                                    window.location.href = address;
                                } else {
                                    window.location.reload();
                                }

                            } else {
                                $(".l_pwd_warn").html("手机号或密码错误").show();
                            }
                        });
                    }
                };
                $("body").off("click", ".l_login").on("click", ".l_login", function() {
                    _login();
                });
                $(document).on("keydown", function(event) {
                    if (event.keyCode == 13) {
                        _login();
                    }
                })
            },
        }




        $('body').on('click', '.home_msg', function() {
            console.log(1);
            Common.checkLoginAuthority();

            // if (!Common.GlobalUserInfo().isLogin) {

            // } else {
            //     $.popwin(temp, {
            //         title: '留言',
            //         fixed: true,
            //     });
            //     $("#popwin_Out").addClass("home_msg_ctr");
            // }
        });
    </script>
</body>